home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / ny_src.zip / IGMSUP.CPP < prev    next >
C/C++ Source or Header  |  1997-04-22  |  26KB  |  931 lines

  1. // include the header
  2. #include "NY2008.h"
  3.  
  4. // include prototypes for fights
  5. #include "fights.h"
  6.  
  7.  
  8. extern struct {
  9.     int        first_enemy[LEVELS],
  10.             last_enemy[LEVELS];
  11.     } enemy_idx;
  12.  
  13. extern unsigned _stklen;
  14.  
  15. // price arrays
  16. extern int no_rip_m;
  17. extern long gun_price[A_BOMB+1];
  18. extern int     drug_price[HEROIN+1];
  19. //extern int fast_mail;
  20. int no_forrest_IGM=FALSE;
  21. extern struct ffblk fff;
  22.  
  23. // Declare global variables
  24. extern int nCurrentUserNumber,max_fights,max_drug_hits,condom_price,delete_after;
  25. extern int bank_interest;
  26. extern char ansi_name[61],ascii_name[61];
  27. extern int do_scr_files;
  28. extern user_rec cur_user;
  29. extern enemy enemy_rec;
  30. extern int registered;
  31. extern char uname[36];
  32. extern char rec_credit[36];
  33. extern int do_maint;
  34. extern char str[15];
  35. extern int expert;
  36. extern int rip;
  37. extern char maint_exec[61];
  38. extern char *t_buffer;
  39. extern int single_node;
  40. extern char *ver;
  41. extern char *verinfo;
  42. extern int gamedisk,flagdisk;
  43. extern char gamedir[MAXDIR],flagdir[MAXDIR];
  44. extern char c_dir_g;
  45. extern int clean_mode;
  46.  
  47. extern int busted_ch_bank;
  48. extern int busted_ch_food;
  49. extern int busted_ch_rape;
  50. extern int busted_ch_beggar;
  51. extern int busted_ch_car;
  52. extern int busted_ch_school;
  53. extern int busted_ch_window;
  54. extern int busted_ch_poison;
  55. extern int busted_ch_bomb;
  56. extern int success_ch_bank;
  57. extern int success_ch_food;
  58. extern int success_ch_rape;
  59. extern int success_ch_beggar;
  60. extern int success_ch_car;
  61. extern int success_ch_school;
  62. extern int success_ch_window;
  63. extern int success_ch_poison;
  64. extern int success_ch_bomb;
  65.  
  66. void
  67. read_IGMs(void)
  68. {
  69.   FILE *tparty;
  70.   FILE *menuthing;
  71.   int ok,x2,x3;
  72.   char *key, kkk;
  73.   int intval;
  74.   char numstr[14];
  75.   char exenam[251];
  76.   char temp[31];
  77.  
  78. /*  printf("\n}{Stack Length=%u}{\n",_stklen);
  79.   scanf("%c",&kkk);*/
  80.  
  81. //  od_printf("\r\n\nreading...\n\n");
  82.  
  83. //  printf("\n\r15\n\r");
  84.  
  85.   ch_game_d();
  86. //  printf("\n\r16\n\r");
  87.   tparty=ShareFileOpen("3RDPARTY.DAT","rt");
  88. //  printf("\n\r17\n\r");
  89.   if(tparty==NULL) {
  90. //    no_forrest_IGM=TRUE;
  91.     return;
  92.   }
  93. //  printf("\n\r18\n\r");
  94.   ch_flag_d();
  95.   sprintf(numstr,"MNU%d.DAT",od_control.od_node);
  96.   menuthing=ShareFileOpen(numstr,"wb");
  97.   ch_game_d();
  98.  
  99.   ok=0;
  100.   while(tparty!=NULL && ok!=2 && fgets(temp,30,tparty)!=NULL) {
  101. //    od_printf("\n\n1111...\n\n");
  102.     ok=0;
  103.     if((key=strchr(temp,'\n'))!=0)
  104.       *key=0;
  105.     else
  106.       while (kkk!='\n') fscanf(tparty,"%c",&kkk);
  107.     if((key=strchr(temp,';'))!=0)
  108.       *key=0;
  109.     if (temp[0]!=0) {
  110. //      od_printf("\n\n2222...\n\n");
  111.       while (ok==0) {
  112.     if (fgets(exenam,250,tparty)!=NULL) {
  113.       if((key=strchr(exenam,'\n'))!=0)
  114.         *key=0;
  115.       else
  116.         while (kkk!='\n') fscanf(tparty,"%c",&kkk);
  117.       if((key=strchr(exenam,';'))!=0)
  118.         *key=0;
  119.       if (exenam[0]!=0) ok=1;
  120.       if((key=strchr(exenam,'{'))!=0) {
  121.         for(x2=0;x2<=30 && *(key+x2+1)!='}' && *(key+x2+1)!=0;x2++) {
  122.           numstr[x2]= *(key+x2+1);
  123.           od_kernel();
  124.         }
  125.         numstr[x2]=0;
  126.         x3=x2;
  127.         x2++;
  128.         if(*(key+x2)==0) *(key+x2+1)=0;
  129.         while(*(key+x2+1)!=0) {
  130.           *(key+x2-x3-1)= *(key+x2+1);
  131.           x2++;
  132.           od_kernel();
  133.         }
  134.         *(key+x2-x3-1)=0;
  135.         sscanf(numstr,"%d",&intval);
  136.         if(od_control.user_security<intval) ok=3;
  137.       }
  138.     } else {
  139.       ok=2;
  140.     }
  141.       }
  142. //      od_printf("\n\n1111 <%d>...\n\n",ok);
  143.       if (ok==1) {
  144. //    od_printf("\n\n4444...\n\n");
  145.     ny_fwrite(temp,31,1,menuthing);
  146.     ny_fwrite(exenam,251,1,menuthing);
  147.       }
  148.     }
  149.   }
  150. //  WaitForEnter();
  151.   fclose(tparty);
  152.   fclose(menuthing);
  153. }
  154.  
  155.  
  156. void
  157. read_fight_IGMs(void)
  158. {
  159.   FILE *tparty;
  160.   FILE *menuthing;
  161.   int ok,x2,x3;
  162.   char *key, kkk;
  163.   int intval;
  164.   char numstr[14];
  165.   char exenam[251];
  166.   char temp[31];
  167.  
  168. //  od_printf("\r\n\nreading...\n\n");
  169.  
  170. //  printf("\n\r20\n\r");
  171.   ch_game_d();
  172. //  printf("\n\r21\n\r");
  173.   tparty=ShareFileOpen("3RDEVENT.DAT","rt");
  174. //  printf("\n\r22\n\r");
  175.   if(tparty==NULL) {
  176.     no_forrest_IGM=TRUE;
  177.     return;
  178.   }
  179. //  printf("\n\r23\n\r");
  180.   ch_flag_d();
  181.   sprintf(numstr,"FEV%d.DAT",od_control.od_node);
  182.   menuthing=ShareFileOpen(numstr,"wb");
  183.   ch_game_d();
  184.  
  185.   ok=0;
  186.   while(tparty!=NULL && ok!=2 && fgets(temp,30,tparty)!=NULL) {
  187. //    od_printf("\n\n1111...\n\n");
  188.     ok=0;
  189.     if((key=strchr(temp,'\n'))!=0)
  190.       *key=0;
  191.     else
  192.       while (kkk!='\n') fscanf(tparty,"%c",&kkk);
  193.     if((key=strchr(temp,';'))!=0)
  194.       *key=0;
  195.     if (temp[0]!=0) {
  196. //      od_printf("\n\n2222...\n\n");
  197.       while (ok==0) {
  198.     if (fgets(exenam,250,tparty)!=NULL) {
  199.       if((key=strchr(exenam,'\n'))!=0)
  200.         *key=0;
  201.       else
  202.         while (kkk!='\n') fscanf(tparty,"%c",&kkk);
  203.       if((key=strchr(exenam,';'))!=0)
  204.         *key=0;
  205.       if (exenam[0]!=0) ok=1;
  206.       if((key=strchr(exenam,'{'))!=0) {
  207.         for(x2=0;x2<=30 && *(key+x2+1)!='}' && *(key+x2+1)!=0;x2++) {
  208.           numstr[x2]= *(key+x2+1);
  209.           od_kernel();
  210.         }
  211.         numstr[x2]=0;
  212.         x3=x2;
  213.         x2++;
  214.         if(*(key+x2)==0) *(key+x2+1)=0;
  215.         while(*(key+x2+1)!=0) {
  216.           *(key+x2-x3-1)= *(key+x2+1);
  217.           x2++;
  218.           od_kernel();
  219.         }
  220.         *(key+x2-x3-1)=0;
  221.         sscanf(numstr,"%d",&intval);
  222.         if(od_control.user_security<intval) ok=3;
  223.       }
  224.     } else {
  225.       ok=2;
  226.     }
  227.       }
  228. //      od_printf("\n\n1111 <%d>...\n\n",ok);
  229.       if (ok==1) {
  230. //    od_printf("\n\n4444...\n\n");
  231.     ny_fwrite(temp,31,1,menuthing);
  232.     ny_fwrite(exenam,251,1,menuthing);
  233.       }
  234.     }
  235.   }
  236. //  WaitForEnter();
  237.   fclose(tparty);
  238.   fclose(menuthing);
  239. }
  240.  
  241.  
  242.  
  243. void
  244. IGM(char exenamr[])
  245. {
  246.     char temp[31];
  247.     int x,x1,found_file;
  248. //    FILE *tparty;
  249.     FILE *menuthing;
  250. //    char kkk;
  251. //    char *key;
  252.     long intval;
  253.     char numstr[14];
  254.     char exenam[251];
  255.     long maxnum;
  256.     int ok;
  257.     static long where=0;
  258.  
  259.     all_over_igm:;
  260.     //od_control.od_ker_exec=NULL;
  261.     od_clear_keybuffer();
  262.     od_printf("\n\r\n");
  263.     if (expert!=2 && expert!=3) ny_clr_scr();
  264.  
  265.     if (expert==2 || expert==3) {
  266.       ny_line(351,0,1);
  267. //      od_printf("\n\r`bright red`O`red`ther `bright red`S`red`tuff\n\r");
  268.       ny_line(352,0,1);
  269. //      od_printf("`bright green`? = list  Q = Quit\n\r`bright blue`E`blue`nter `bright blue`Y`blue`er `bright blue`C`blue`ommand (%d mins)`bright blue`>",od_control.caller_timelimit);
  270.       ny_line(36,0,0);
  271.       od_printf("%d ",od_control.caller_timelimit);
  272.       ny_line(37,0,0);
  273.       maxnum=20;
  274.       ch_flag_d();
  275.       sprintf(numstr,"MNU%d.DAT",od_control.od_node);
  276.       menuthing=ShareFileOpen(numstr,"rb");
  277.       if((where+(282*20))>=filelength(fileno(menuthing))) {
  278.         maxnum=(filelength(fileno(menuthing))-where)/(long)282;
  279.       } else {
  280.         ok=1;
  281.       }
  282.       fclose(menuthing);
  283.       ch_game_d();
  284.     } else {
  285.       list_igm:;
  286.       found_file=FALSE;
  287.       if(od_send_file("OTHER") == TRUE) found_file=TRUE;
  288.       //od_control.od_ker_exec=NULL;
  289.       //od_send_file("IGM");
  290.       if(found_file==FALSE)
  291.         ny_send_menu(OTHER,"");
  292.  
  293. /*      ny_disp_emu("\n\r`@O`red`ther `bright red`S`red`tuff\n\r\n");
  294.       od_printf("`green`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  295.       od_printf("`bright blue`You go and look for something less boring ...\n\r\n");*/
  296.  
  297.       ch_flag_d();
  298.       sprintf(numstr,"MNU%d.DAT",od_control.od_node);
  299.       menuthing=ShareFileOpen(numstr,"rb");
  300.       ch_game_d();
  301.  
  302.       if(found_file==FALSE) {
  303.         fseek(menuthing,where,SEEK_SET);
  304.         x=1;
  305.         while(menuthing!=NULL && x<=20 && ny_fread(temp,31,1,menuthing)!=NULL) {
  306.           ny_fread(exenam,251,1,menuthing);
  307.           if(found_file==FALSE) {
  308.         od_printf(" `bright red`%-2d`red` - ",x);
  309.         ny_disp_emu(temp,30);
  310.         od_printf("  ");
  311.         if ((int)(x/2) * 2 == x )
  312.           od_printf("\n\r");
  313.           }
  314.           x++;
  315.         }
  316.         maxnum=x-1;
  317.         if ((int)(x/2) * 2 == x )
  318.           od_printf("\n\r");
  319.         if (x==1)
  320.           ny_line(178,0,1);
  321.         od_printf("\n\r");
  322.         if(where>0) ny_line(409,0,0);
  323.         ok=0;
  324.         if(filelength(fileno(menuthing))>ftell(menuthing)) {
  325.           ny_line(410,0,0);
  326.           ok=1;
  327.         }
  328.         ny_line(179,0,2);
  329.       } else {
  330.         maxnum=filelength(fileno(menuthing))/(long)282;
  331.         od_printf("\n\r");
  332.       }
  333.       fclose(menuthing);
  334.  
  335.       ny_line(36,0,0);
  336.       od_printf("%d ",od_control.caller_timelimit);
  337.       ny_line(37,0,0);
  338.     }
  339.     //od_control.od_ker_exec=ny_kernel;
  340.  
  341.     x1=0;
  342.     do {
  343.       if(x1==0)
  344.         numstr[0]=ny_get_answer("0123456789QPN?\b\n\r");
  345.       else
  346.         numstr[x1]=ny_get_answer("0123456789\b\n\r");
  347.       x1++;
  348.       if(numstr[x1-1]=='\b') {
  349.         if(x1>1) {
  350.           od_printf("\b \b");
  351.           x1-=2;
  352.         } else {                                              x1--;
  353.         }
  354.       } else {
  355.         if(numstr[x1-1]!='\r')
  356.           od_putch(numstr[x1-1]);
  357.       }
  358.     } while(numstr[x1-1]!='\n' &&
  359.         numstr[x1-1]!='\r' &&
  360.         numstr[0]!='Q' &&
  361.         numstr[0]!='P' &&
  362.         numstr[0]!='N' &&
  363.         numstr[0]!='?' &&
  364.         x1<10);
  365.  
  366. //    printf("%ld",maxnum);
  367.  
  368.     numstr[x1]=0;
  369. //
  370. //    printf("\n%s",numstr);
  371.  
  372. //    od_input_str(numstr,2,' ',127);
  373.     if(expert==1) expert=3;
  374.     if (numstr[0]==0) {
  375.       exenamr[0]=0;
  376.       return;
  377.     }
  378.     if (numstr[0]=='?') {
  379.       od_printf("\n\r\n");
  380.       ny_clr_scr();
  381.       goto list_igm;
  382.     }
  383.     if (numstr[0]=='Q') {
  384.       exenamr[0]=0;
  385.       return;
  386.     }
  387.  
  388.     if (found_file==FALSE &&
  389.         ok==1 &&
  390.         numstr[0]=='N') {
  391.       if(expert==3) expert=1;
  392.       where+=282*20;
  393.       goto all_over_igm;
  394.     }
  395.     if (found_file==FALSE &&
  396.         where>0 &&
  397.         numstr[0]=='P') {
  398.       if(expert==3) expert=1;
  399.       where-=282*20;
  400.       goto all_over_igm;
  401.     }
  402.  
  403.     sscanf(numstr,"%ld",&intval);
  404.  
  405.     if (intval==0 || intval>maxnum) {
  406.       goto all_over_igm;
  407.     }
  408.  
  409.  
  410.     ch_flag_d();
  411.     sprintf(numstr,"MNU%d.DAT",od_control.od_node);
  412.     menuthing=ShareFileOpen(numstr,"rb");
  413.     ch_game_d();
  414.  
  415.     fseek(menuthing,where+((intval-1)*282)+31,SEEK_SET);
  416.     ny_fread(exenamr,251,1,menuthing);
  417. //    printf("%s",exenamr);
  418.     fclose(menuthing);
  419.  
  420.     return;
  421. }
  422.  
  423.  
  424.  
  425. void
  426. forrest_IGM()
  427. {
  428.     char exenamr[251];
  429.     char temp[31];
  430.     char key;
  431.     FILE *menuthing;
  432.     int intval;
  433.     char numstr[14];
  434.     long maxnum;
  435.     //od_control.od_ker_exec=NULL;
  436.     no_rip_m=0;
  437.     od_clear_keybuffer();
  438.     od_printf("\n\r\n");
  439.     ny_clr_scr();
  440.     ch_flag_d();
  441.     sprintf(numstr,"FEV%d.DAT",od_control.od_node);
  442.     menuthing=ShareFileOpen(numstr,"rb");
  443.     maxnum=filelength(fileno(menuthing))/(long)282;
  444.     intval=random((int)maxnum);
  445.     fseek(menuthing,intval*282,SEEK_SET);
  446.     ny_fread(temp,31,1,menuthing);
  447.     ny_fread(exenamr,251,1,menuthing);
  448.     fclose(menuthing);
  449.     ch_game_d();
  450.  
  451.     if(rip==FALSE) {
  452.       ny_line(411,0,2);
  453.       ny_disp_emu(temp);
  454.     } else {
  455.       ny_line(411,1,0);
  456.       od_disp_str(ny_un_emu(temp));
  457.       od_disp_str("::^M@OK))|#|#|#\n\r");
  458.       od_get_answer("\n\r");
  459.     }
  460.     ny_line(412,2,0);
  461.     key=ny_get_answer("YN");
  462.     if(rip==FALSE)
  463.       od_printf("%c\n\r\n",key);
  464.     else
  465.       od_disp_str("\n\r\n");
  466.  
  467.  
  468.     if(key=='Y')
  469.       call_IGM(exenamr);
  470.  
  471.     return;
  472. }
  473.  
  474.  
  475.  
  476.  
  477.       //    od_putch(key);
  478.  
  479.       //    return(key);
  480.  
  481.  
  482. void
  483. IGM_ops(void)
  484. {
  485.   char exenam[251];
  486.   do {
  487.     ch_game_d();
  488.     IGM(exenam);
  489.     if(exenam[0]!=0)
  490.       call_IGM(exenam);
  491.   } while(exenam[0]!=0);
  492.  
  493. }
  494.  
  495. void
  496. CreateDropFile(int all)
  497. {
  498.   char numstr[25];
  499.   FILE *justfile;
  500.  
  501.   if(all==TRUE)
  502.     sprintf(numstr,"u%07d.inf",nCurrentUserNumber);
  503.   else
  504.     strcpy(numstr,"3rdmnt.inf");
  505.   justfile=ShareFileOpen(numstr,"w+t");
  506.   fprintf(justfile,"%s\n",od_control.info_path);
  507.   fprintf(justfile,"%d\n",od_control.caller_timelimit);
  508.   fprintf(justfile,"%d\n",od_control.port);
  509.   fprintf(justfile,"%lu\n",od_control.baud);
  510.   if(od_control.user_avatar!=FALSE) {
  511.     fprintf(justfile,"AVATAR");
  512.   } else if(od_control.user_ansi!=FALSE || rip==TRUE) {
  513.     fprintf(justfile,"ANSI");
  514.   } else {
  515.     fprintf(justfile,"ASCII");
  516.   }
  517.   fprintf(justfile,"\n%s\n",od_control.user_location);
  518.   if(od_control.od_com_method==COM_FOSSIL)
  519.     fprintf(justfile,"FOSSIL\n");
  520.   else {
  521.     fprintf(justfile,"NOFOSSIL\n");
  522.     fprintf(justfile,"%d\n",od_control.od_com_address); //
  523.     fprintf(justfile,"%d\n",(int)od_control.od_com_irq);
  524.     if (od_control.od_com_no_fifo==TRUE)
  525.       fprintf(justfile,"NOFIFO\n");
  526.     else
  527.       fprintf(justfile,"FIFO\n");
  528.     fprintf(justfile,"%d\n",(int)od_control.od_com_fifo_trigger);
  529.     fprintf(justfile,"%u\n",(int)od_control.od_com_rx_buf);
  530.     fprintf(justfile,"%u\n",(int)od_control.od_com_tx_buf);
  531.   }
  532.   fclose(justfile);
  533.  
  534.  if(all==TRUE) {
  535.   sprintf(numstr,"n%07d.sts",od_control.od_node);
  536.   justfile=ShareFileOpen(numstr,"wb");
  537.   ny_fwrite(&cur_user,sizeof(user_rec),1,justfile);
  538.   fclose(justfile);
  539.  
  540.   sprintf(numstr,"n%07d.stt",od_control.od_node);
  541.   justfile=ShareFileOpen(numstr,"wt");
  542.  
  543.   fprintf(justfile,"%s\n",cur_user.bbsname);     //the BBS name of the user
  544.   fprintf(justfile,"%s\n",cur_user.name);        //the name of the character
  545.   fprintf(justfile,"%s\n",cur_user.say_win);     //what the user says when he wins
  546.   fprintf(justfile,"%s\n",cur_user.say_loose);   // "    "    "   "    "   "  looses
  547.   fprintf(justfile,"%d\n",cur_user.rank);             //user rank
  548.   fprintf(justfile,"%d\n",cur_user.days_not_on);     //days the user has been inactive
  549.   fprintf(justfile,"%d\n",cur_user.strength);        //attacking strenght of the user
  550.   fprintf(justfile,"%d\n",cur_user.defense);         //defensive strenght
  551.   fprintf(justfile,"%d\n",cur_user.condoms);         //condoms user has
  552.   fprintf(justfile,"%d\n",cur_user.since_got_laid);  //days since the user last got laid
  553.   fprintf(justfile,"%d\n",cur_user.drug_hits);       //the hist that the user has
  554.   fprintf(justfile,"%d\n",cur_user.drug_days_since); //if addicted how long the user
  555.                      //has not used the drug
  556.   fprintf(justfile,"%ld\n",cur_user.hitpoints);       //users hitpoints
  557.   fprintf(justfile,"%ld\n",cur_user.maxhitpoints);    //maximum of the users hitpoints
  558.   fprintf(justfile,"%lu\n",cur_user.points);          //users points
  559.   fprintf(justfile,"%lu\n",cur_user.money);           //money in hand
  560.   fprintf(justfile,"%lu\n",cur_user.bank);            //money in bank
  561.   fprintf(justfile,"%d\n",(int)cur_user.level);           //user level
  562.   fprintf(justfile,"%d\n",(int)cur_user.turns);           //fight the user has left today
  563.   fprintf(justfile,"%d\n",(int)cur_user.hunger);          // % of hunger
  564.   fprintf(justfile,"%d\n",(int)cur_user.sex_today);       //sex turns left today
  565.   fprintf(justfile,"%d\n",(int)cur_user.std_percent);     // % of current std
  566.   fprintf(justfile,"%d\n",(int)cur_user.drug_addiction);  // % of drug addiction
  567.   fprintf(justfile,"%d\n",(int)cur_user.drug_high);       // % of how "high" the player is
  568.   fprintf(justfile,"%d\n",(int)cur_user.hotel_paid_fer);  //for how many more days the hotel
  569.                      //is paid for
  570.   fprintf(justfile,"%d\n",(int)cur_user.days_in_hospital);//how many days has the use been
  571.                      //in hospital
  572.  
  573.   if(cur_user.alive==ALIVE)
  574.     fprintf(justfile,"ALIVE\n");
  575.   else
  576.     fprintf(justfile,"UNCONSIOUS\n");
  577.   if(cur_user.sex==MALE)
  578.     fprintf(justfile,"M\n");
  579.   else
  580.     fprintf(justfile,"F\n");
  581.  
  582.   if(cur_user.nation==PUNK)
  583.     fprintf(justfile,"PUNK\n");
  584.   else if(cur_user.nation==HEADBANGER)
  585.     fprintf(justfile,"HEADBANGER\n");
  586.   else if(cur_user.nation==BIG_FAT_DUDE)
  587.     fprintf(justfile,"BIG FAT DUDE\n");
  588.   else if(cur_user.nation==CRACK_ADDICT)
  589.     fprintf(justfile,"CRACK ADDICT\n");
  590.   else
  591.     fprintf(justfile,"HIPPIE\n");
  592.   fprintf(justfile,"%d\n",(int)cur_user.arm);
  593.   if(cur_user.std==CRAPS)
  594.     fprintf(justfile,"CRAPS\n");
  595.   else if(cur_user.std==HERPES)
  596.     fprintf(justfile,"HERPES\n");
  597.   else if(cur_user.std==SYPHILIS)
  598.     fprintf(justfile,"SYPHILIS\n");
  599.   else if(cur_user.std==AIDS)
  600.     fprintf(justfile,"AIDS\n");
  601.   else
  602.     fprintf(justfile,"NONE\n");
  603.  
  604.   if(cur_user.drug==POT)
  605.     fprintf(justfile,"POT\n");
  606.   else if(cur_user.drug==HASH)
  607.     fprintf(justfile,"HASH\n");
  608.   else if(cur_user.drug==LSD)
  609.     fprintf(justfile,"LSD\n");
  610.   else if(cur_user.drug==COKE)
  611.     fprintf(justfile,"COKE\n");
  612.   else if(cur_user.drug==PCP)
  613.     fprintf(justfile,"PCP\n");
  614.   else
  615.     fprintf(justfile,"HEROIN\n");
  616.  
  617.  
  618.   if(cur_user.rest_where==NOWHERE)
  619.     fprintf(justfile,"NOWHERE\n");
  620.   else if(cur_user.rest_where==MOTEL)
  621.     fprintf(justfile,"MOTEL\n");
  622.   else if(cur_user.rest_where==REG_HOTEL)
  623.     fprintf(justfile,"REGULAR HOTEL\n");
  624.   else
  625.     fprintf(justfile,"EXPENSIVE HOTEL\n");
  626.  
  627.   fprintf(justfile,"%d\n",(int)cur_user.wtc);
  628.   fprintf(justfile,"%d\n",(int)cur_user.poison);
  629.   fprintf(justfile,"%d\n",(int)cur_user.rocks);
  630.   fprintf(justfile,"%d\n",(int)cur_user.throwing_ability);
  631.   fprintf(justfile,"%d\n",(int)cur_user.punch_ability);
  632.   fprintf(justfile,"%d\n",(int)cur_user.kick_ability);
  633.   fprintf(justfile,"%d\n",(int)cur_user.InterBBSMoves);
  634.  
  635. /*reserved for future use 3 bytes reset to 0
  636.     char        res1;
  637.     int        res2;*/
  638.  
  639.   fclose(justfile);
  640.  }
  641. }
  642.  
  643. void
  644. call_IGM(char exenam[])
  645. {
  646. //  char exenam[251];
  647.   char exenam2[81];
  648.   char numstr[40];
  649.   char bbs_name[40];
  650.   FILE *justfile;
  651.   unsigned long p_before;
  652.   unsigned long p_diff;
  653.   int x,x2;
  654.   char *key;
  655. //  ffblk ffblk;
  656.   int intval;
  657.   int rankt,inact;
  658.  
  659.  
  660.  
  661.       ny_line(180,2,1);
  662.       p_before=cur_user.points;
  663.       CreateDropFile(TRUE);
  664.       if(exenam[0]=='*') {
  665.     for(x=1;exenam[x]!=0;x++) {
  666.       exenam[x-1]=exenam[x];
  667.     }
  668.     exenam[x-1]=0;
  669.  
  670.     for(x=0;exenam[x]!=' '&& exenam[x]!=0 && x<251;x++) {
  671.       exenam2[x]=exenam[x];
  672.     }
  673.     exenam2[x]=0;
  674.  
  675.     for(;exenam2[x]!='\\' && x>=0;x--);
  676.  
  677.     exenam2[x+1]=0;
  678.     if(x>2)
  679.       exenam2[x]=0;
  680.  
  681.     if(exenam2[0]!=0) {
  682.       if(exenam2[0]>='a' && exenam2[0]<='z')
  683.         setdisk(exenam2[0] - 'a');
  684.       else
  685.         setdisk(exenam2[0] - 'A');
  686.       chdir(exenam2);
  687.     }
  688.       }
  689.       sprintf(numstr," -U%d -N%d",nCurrentUserNumber,od_control.od_node);
  690.       strcat(exenam,numstr);
  691.       if (od_control.baud==0) strcat(exenam," -L");
  692.       //od_control.od_ker_exec=NULL;
  693.       rankt=cur_user.rank;
  694.       inact=cur_user.days_not_on;
  695.       strcpy(bbs_name,cur_user.bbsname);
  696.       od_spawn(exenam);
  697.       od_control.od_update_status_now=TRUE;
  698.       sprintf(numstr,"n%07d.sts",od_control.od_node);
  699.       c_dir_g=1;
  700.       ch_game_d();
  701.  
  702.       if(findfirst(numstr,&fff,0)==0) {
  703.     justfile=ShareFileOpen(numstr,"rb");
  704.     ny_fread(&cur_user,sizeof(user_rec),1,justfile);
  705.     fclose(justfile);
  706.     ny_remove(numstr);
  707.     cur_user.rank=rankt;
  708.     cur_user.days_not_on=inact;
  709.     strcpy(cur_user.bbsname,bbs_name);
  710.     wrt_sts();
  711.       } else {
  712.     sprintf(numstr,"n%07d.stt",od_control.od_node);
  713.     if(findfirst(numstr,&fff,0)==0) {
  714.       justfile=ShareFileOpen(numstr,"rb");
  715.  
  716.  /*      fgets(cur_user.bbsname,36,justfile);     //the BBS name of the user
  717.       cur_user.bbsname[35]=0;
  718.       if((key=strchr(cur_user.bbsname,'\n'))!=NULL)
  719.         *key=0;
  720.       if((key=strchr(cur_user.bbsname,'\r'))!=NULL)
  721.         *key=0;*/
  722.  
  723.       fgets(bbs_name,36,justfile); /*BBS name not read in no more*/
  724.  
  725.       fgets(cur_user.name,25,justfile);     //the BBS name of the user
  726.       cur_user.name[24]=0;
  727.       if((key=strchr(cur_user.name,'\n'))!=NULL)
  728.         *key=0;
  729.       if((key=strchr(cur_user.name,'\r'))!=NULL)
  730.         *key=0;
  731.  
  732.  
  733.       fgets(cur_user.say_win,41,justfile);     //the BBS name of the user
  734.       cur_user.say_win[40]=0;
  735.       if((key=strchr(cur_user.say_win,'\n'))!=NULL)
  736.         *key=0;
  737.       if((key=strchr(cur_user.say_win,'\r'))!=NULL)
  738.         *key=0;
  739.  
  740.  
  741.       fgets(cur_user.say_loose,41,justfile);     //the BBS name of the user
  742.       cur_user.say_loose[40]=0;
  743.       if((key=strchr(cur_user.say_loose,'\n'))!=NULL)
  744.         *key=0;
  745.       if((key=strchr(cur_user.say_loose,'\r'))!=NULL)
  746.         *key=0;
  747.  
  748.  
  749.       fgets(numstr,30,justfile);
  750.       //sscanf(numstr,"%d",&cur_user.rank);             //user rank
  751.       fgets(numstr,30,justfile);
  752.       //sscanf(numstr,"%d",&cur_user.days_not_on);     //days the user has been inactive
  753.       fgets(numstr,30,justfile);
  754.       sscanf(numstr,"%d",&cur_user.strength);        //attacking strenght of the user
  755.       fgets(numstr,30,justfile);
  756.       sscanf(numstr,"%d",&cur_user.defense);         //defensive strenght
  757.       fgets(numstr,30,justfile);
  758.       sscanf(numstr,"%d",&cur_user.condoms);         //condoms user has
  759.       fgets(numstr,30,justfile);
  760.       sscanf(numstr,"%d",&cur_user.since_got_laid);  //days since the user last got laid
  761.       fgets(numstr,30,justfile);
  762.       sscanf(numstr,"%d",&cur_user.drug_hits);       //the hist that the user has
  763.       fgets(numstr,30,justfile);
  764.       sscanf(numstr,"%d",&cur_user.drug_days_since); //if addicted how long the user
  765.                      //has not used the drug
  766.       fgets(numstr,30,justfile);
  767.       sscanf(numstr,"%ld",&cur_user.hitpoints);       //users hitpoints
  768.       fgets(numstr,30,justfile);
  769.       sscanf(numstr,"%ld",&cur_user.maxhitpoints);    //maximum of the users hitpoints
  770.       fgets(numstr,30,justfile);
  771.       sscanf(numstr,"%lu",&cur_user.points);          //users points
  772.       fgets(numstr,30,justfile);
  773.       sscanf(numstr,"%lu",&cur_user.money);           //money in hand
  774.       fgets(numstr,30,justfile);
  775.       sscanf(numstr,"%lu",&cur_user.bank);            //money in bank
  776.       fgets(numstr,30,justfile);
  777.       sscanf(numstr,"%d",&intval);
  778.       cur_user.level=intval;           //user level
  779.       fgets(numstr,30,justfile);
  780.       sscanf(numstr,"%d",&intval);
  781.       cur_user.turns=intval;           //fight the user has left today
  782.       fgets(numstr,30,justfile);
  783.       sscanf(numstr,"%d",&intval);
  784.       cur_user.hunger=intval;          // % of hunger
  785.       fgets(numstr,30,justfile);
  786.       sscanf(numstr,"%d",&intval);
  787.       cur_user.sex_today=intval;       //sex turns left today
  788.       fgets(numstr,30,justfile);
  789.       sscanf(numstr,"%d",&intval);
  790.       cur_user.std_percent=intval;     // % of current std
  791.       fgets(numstr,30,justfile);
  792.       sscanf(numstr,"%d",&intval);
  793.       cur_user.drug_addiction=intval;  // % of drug addiction
  794.       fgets(numstr,30,justfile);
  795.       sscanf(numstr,"%d",&intval);
  796.       cur_user.drug_high=intval;       // % of how "high" the player is
  797.       fgets(numstr,30,justfile);
  798.       sscanf(numstr,"%d",&intval);
  799.       cur_user.hotel_paid_fer=intval;  //for how many more days the hotel
  800.                      //is paid for
  801.       fgets(numstr,30,justfile);
  802.       sscanf(numstr,"%d",&intval);
  803.       cur_user.days_in_hospital=intval;//how many days has the use been
  804.                          //in hospital
  805.  
  806.       fgets(numstr,30,justfile);
  807.       if(strzcmp("ALIVE",numstr)==0)
  808.         cur_user.alive=ALIVE;
  809.       else if(strzcmp("DEAD",numstr)==0)
  810.         cur_user.alive=DEAD;
  811.       else if(strzcmp("UNCONSIOUS",numstr)==0)
  812.         cur_user.alive=UNCONCIOUS;
  813.  
  814.  
  815.       fgets(numstr,30,justfile);
  816.       if(strzcmp("M",numstr)==0)
  817.         cur_user.sex=MALE;
  818.       else if(strzcmp("F",numstr)==0)
  819.         cur_user.sex=FEMALE;
  820.  
  821.  
  822.       fgets(numstr,30,justfile);
  823.       if(strzcmp("PUNK",numstr)==0)
  824.         cur_user.nation=PUNK;
  825.       else if(strzcmp("HEADBANGER",numstr)==0)
  826.         cur_user.nation=HEADBANGER;
  827.       else if(strzcmp("BIG FAT DUDE",numstr)==0)
  828.         cur_user.nation=BIG_FAT_DUDE;
  829.       else if(strzcmp("CRACK ADDICT",numstr)==0)
  830.         cur_user.nation=CRACK_ADDICT;
  831.       else if(strzcmp("HIPPIE",numstr)==0)
  832.         cur_user.nation=HIPPIE;
  833.  
  834.       fgets(numstr,30,justfile);
  835.       sscanf(numstr,"%d",&intval);
  836.       cur_user.arm=(weapon)intval;
  837.  
  838.  
  839.       fgets(numstr,30,justfile);
  840.       if(strzcmp("CRAPS",numstr)==0)
  841.         cur_user.std=CRAPS;
  842.       else if(strzcmp("HERPES",numstr)==0)
  843.         cur_user.std=HERPES;
  844.       else if(strzcmp("SYPHILIS",numstr)==0)
  845.         cur_user.std=SYPHILIS;
  846.       else if(strzcmp("AIDS",numstr)==0)
  847.         cur_user.std=AIDS;
  848.       else if(strzcmp("NONE",numstr)==0)
  849.         cur_user.std=NONE;
  850.  
  851.  
  852.       fgets(numstr,30,justfile);
  853.       if(strzcmp("POT",numstr)==0)
  854.         cur_user.drug=POT;
  855.       else if(strzcmp("HASH",numstr)==0)
  856.         cur_user.drug=HASH;
  857.       else if(strzcmp("LSD",numstr)==0)
  858.         cur_user.drug=LSD;
  859.       else if(strzcmp("COKE",numstr)==0)
  860.         cur_user.drug=COKE;
  861.       else if(strzcmp("PCP",numstr)==0)
  862.         cur_user.drug=PCP;
  863.       else if(strzcmp("HEROIN",numstr)==0)
  864.         cur_user.drug=HEROIN;
  865.  
  866.  
  867.  
  868.       fgets(numstr,30,justfile);
  869.       if(strzcmp("MOTEL",numstr)==0)
  870.         cur_user.rest_where=MOTEL;
  871.       else if(strzcmp("REGULAR HOTEL",numstr)==0)
  872.         cur_user.rest_where=REG_HOTEL;
  873.       else if(strzcmp("EXPENSIVE HOTEL",numstr)==0)
  874.         cur_user.rest_where=EXP_HOTEL;
  875.       else if(strzcmp("NOWHERE",numstr)==0)
  876.         cur_user.rest_where=NOWHERE;
  877.  
  878.       fgets(numstr,30,justfile);
  879.       sscanf(numstr,"%d",&intval);
  880.       cur_user.wtc=intval;
  881.       fgets(numstr,30,justfile);
  882.       sscanf(numstr,"%d",&intval);
  883.       cur_user.poison=intval;
  884.  
  885.       fgets(numstr,30,justfile);
  886.       sscanf(numstr,"%d",&intval);
  887.       cur_user.rocks=intval;
  888.  
  889.       fgets(numstr,30,justfile);
  890.       sscanf(numstr,"%d",&intval);
  891.       cur_user.throwing_ability=intval;
  892.  
  893.       fgets(numstr,30,justfile);
  894.       sscanf(numstr,"%d",&intval);
  895.       cur_user.punch_ability=intval;
  896.  
  897.       fgets(numstr,30,justfile);
  898.       sscanf(numstr,"%d",&intval);
  899.       cur_user.kick_ability=intval;
  900.  
  901.       fgets(numstr,30,justfile);
  902.       sscanf(numstr,"%d",&intval);
  903.       cur_user.InterBBSMoves=intval;
  904.  
  905.       fclose(justfile);
  906.  
  907.       sprintf(numstr,"n%07d.stt",od_control.od_node);
  908.       ny_remove(numstr);
  909.     }
  910.       }
  911.  
  912.       sprintf(numstr,"u%07d.inf",nCurrentUserNumber);
  913.       ny_remove(numstr);
  914.       if(p_before>cur_user.points) {
  915.     p_diff=p_before-cur_user.points;
  916.     cur_user.points=p_before;
  917.     points_loose(p_diff);
  918.       } else if (p_before<cur_user.points) {
  919.     p_diff=cur_user.points-p_before;
  920.     cur_user.points=p_before;
  921.     points_raise(p_diff);
  922.       }
  923.       wrt_sts();
  924.       if(cur_user.alive!=DEAD && cur_user.drug_addiction>=100) Die(1);
  925.       if(cur_user.alive!=DEAD && cur_user.hunger>=100) Die(2);
  926.       if(cur_user.alive!=DEAD && cur_user.std_percent>=100) Die(3);
  927.       ny_kernel();
  928.       //od_control.od_ker_exec=ny_kernel;
  929.       if (cur_user.alive!=ALIVE) od_exit(10,FALSE);
  930. }
  931.